package com.xxx.system.service.Impl;

import com.github.pagehelper.PageHelper;
import com.xxx.system.domain.Permission;
import com.xxx.system.mapper.PermissionMapper;
import com.xxx.system.query.MenuQuery;
import com.xxx.system.query.PermissionQuery;
import com.xxx.system.service.permissionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

@Service
public class PermissionServiceImpl implements permissionService {
    @Autowired
    private PermissionMapper permissionMapper;

    @Override
    public List<Permission> findAll() {
        return permissionMapper.findAll();
    }

    @Override
    public Permission findOne(Long id) {
        return permissionMapper.findOne(id);
    }

    @Override
    public List<Permission> queryPage(PermissionQuery permissionQuery) {
        PageHelper.startPage(permissionQuery.getCurrentPage(),permissionQuery.getPageSize());
        return permissionMapper.queryPage(permissionQuery);
    }

    @Override
    public void addPermission(Permission permission) {
            permissionMapper.addPermission(permission);
    }

    @Override
    public void updatePermission(Permission permission) {
        permissionMapper.updatePermission(permission);
    }

    @Override
    public void deletePermissionById(Long id) {
            permissionMapper.deletePermissionById(id);
    }

    @Override
    public void deletePermissionByIds(Long[] ids) {
            permissionMapper.deletePermissionByIds(ids);
    }

    @Override
    public Permission selectBySn(String permissionSn) {
        return permissionMapper.selectBySn(permissionSn);
    }
}
